package org.noootsab.gae.games.tzaar.event {
import flash.events.Event;

import org.noootsab.gae.games.tzaar.model.game.Piece;

public class PieceEvent extends Event {
    //event fired when a piece is stacked by another
    public static const STACK_ON_EVENT:String = "stackOn";
    public static const STACKED_BY_EVENT:String = "stackedBy";
    public static const TAKE_EVENT:String = "take";
    public static const TAKEN_BY_EVENT:String = "takenBy";

    public var piece:Piece;

    public function PieceEvent(type:String, piece:Piece) {
        super(type, false, false);
        if (type !== STACK_ON_EVENT && type !== TAKE_EVENT && type !== STACKED_BY_EVENT && type !== TAKEN_BY_EVENT) {
            throw new Error("Bad type exception!");
        }
        this.piece = piece;
    }

    public override function clone():Event {
        return new PieceEvent(type, piece);
    }
    
}
}